package 对象的打印;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: lenovo
 * Date: 2022-06-26
 * Time: 21:51
 */
class A{
    public String name = "000";
    public int num1=1;

//    @Override
//    public String toString() {
//        return "A{" +
//                "name='" + name + '\'' +
//                ", num1=" + num1 +
//                '}';
//    }

}
public class Test {
    public static void main(String[] args) {
        A a = new A();
        //方式1：通过ret来接收
        String ret = a.toString();
        System.out.println(ret);
        //方式2：直接打印引用
        System.out.println(a);
    }
}
